home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / infor / ddj_more.zip / TOOLS.H < prev   
Text File  |  1993-01-04  |  2KB  |  78 lines

  1. /*----------------------------------------------------------------------*
  2.  *    TOOLS.H: Various #defines and typedefs for GREP            *
  3.  *                                    *
  4.  *    Copyright   (c)   1984  by Allen Holub.  All rights        *
  5.  *    reserved.                            *
  6.  *----------------------------------------------------------------------*
  7.  */
  8.  
  9. /*
  10.  *    #defines for non-printing ASCII characters
  11.  */
  12.  
  13. #define NUL    0x00    /* ^@    */
  14. #define CR    0x0d    /* ^M    */
  15. #define SUB    0x1a    /* ^Z    */
  16. #define CPMEOF    SUB
  17.  
  18. #define    islower(c)    ('a'<=(c) && (c) <= 'z')
  19. #define toupper(c)    (islower(c) ? (c) - ('a' - 'A') : (c) )
  20. #define    max(x,y)    ( ((x) < (y)) ? (y) : (x) )
  21.  
  22. /*    Definitions of meta-characters used in pattern matching routines.
  23.  *    LITCHAR & NCCL are only used as token identifers; all the others
  24.  *    are also both token identifiers and the actual symbol used in 
  25.  *    the regular expression.
  26.  */
  27.  
  28. #define BOL    '^'
  29. #define EOL    '$'
  30. #define ANY    '.'
  31. #define LITCHAR 'L'
  32. #define ESCAPE    '\\'
  33. #define CCL    '['        /* Character class:    [....]        */
  34. #define CCLEND    ']'
  35. #define NEGATE    '^'
  36. #define NCCL    '!'        /* Negative character class [^...]    */
  37. #define CLOSURE    '*'
  38. #define OR_SYM    '|'
  39.  
  40. /*
  41.  *    Tokens are used to hold pattern templates. (see makepat() in
  42.  *    tools.c
  43.  */
  44.  
  45. typedef struct token
  46. {
  47.     char        tok;
  48.     char        lchar;
  49.     char        *bitmap;
  50.     struct token    *next;
  51. }TOKEN;
  52.  
  53. #define TOKSIZE sizeof(TOKEN)
  54.  
  55. /*
  56.  *    An absolute maximum of strings.
  57.  */
  58.  
  59. #define MAXSTR        132        /* Maximum number of characters in
  60.                      *    a line
  61.                      */
  62.                      
  63. extern char    *matchs();
  64. extern char    *amatch();
  65. extern char    *index();
  66. extern TOKEN    *getpat();
  67. extern int    esc();
  68. extern char    *dodash();
  69. extern TOKEN    *makepat();
  70. extern int    unmakepat();
  71. extern int    insert();
  72. extern int    delete();
  73. extern int    isalphanum();
  74. extern char    *stoupper();
  75. extern int    pr_tok();
  76. extern int    pr_line();
  77.  
  78.